<?php

namespace app\controller\mobile;

use app\common\model\Admin;
use app\common\model\setting;
use app\common\model\Forum;
use app\common\model\User;
use app\common\service\IndexService;
use app\common\service\UserService;
use app\common\util\Result;
use think\annotation\route\Get;
use think\annotation\route\Group;
use think\annotation\route\Route;
use think\route\Domain;

#[Group('mobile/index')]
class IndexController extends MobileAuthorizedController
{


    #[Get('index')]
    public function index()
    {
        $user = $this->getUserOrNull();
        return Result::jsonByResult((new IndexService(app()))->index($user));

    }

    #[Get('home')]
    public function home()
    {
        $user = $this->getUserOrNull();
        return Result::jsonByResult((new IndexService(app()))->home($user));

    }

    #[Get('test1')]
    public function test1()
    {
        $a = 382339363000001;
        $b = 8456726791;
        $b =2.1575E2;
        var_dump($b);
        $c = $a + $b;
        $d = $a - $b;
        $div="100000000";

        $str = " $a + $b = $c  ; $a - $b = $d ";
        $strb =  $a/$div ."-". $b/$div ."=". $d/$div;
        $strb =bcdiv($a,$b,8);
        $strc =bcdiv($strb,7,6);
        //保留4位
        var_dump($str);
        var_dump($strb);
        var_dump($strc);
//        $user = $this->getUserOrNull();
//        print_r(getPublicDirUrl());


    }


}
